﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DTO;
using BUS;
using Utility;
using DAL;
public partial class Doanh_Nghiệp_Doanhnghiep_dky : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DoanhNghiep_DTO doanhnghiep = new DoanhNghiep_DTO();

        doanhnghiep.DiaChi = txtdiachi.Text;
        doanhnghiep.DienThoai = txtdienthoai.Text;
        doanhnghiep.Email = txtemail.Text;
        doanhnghiep.Fax = txtfax.Text;
        doanhnghiep.MatKhau = txtmatkhau.Text;
        doanhnghiep.TaiKhoan = 0;
        doanhnghiep.TenDN = txtten.Text;

        if (hinhbando.HasFile)
        {
            string filename = DateTime.Now.Ticks.ToString() + "_" + hinhbando.FileName;
            hinhbando.SaveAs(Server.MapPath("~/Photos/" + filename));

            System.Drawing.Image img = System.Drawing.Image.FromFile(
                Server.MapPath("~/Photos/" + filename));

            ImageUtility.MakeThumbnailPhoto(
                img, 100, 100, Server.MapPath("~/Photos/Thumb/"), filename);

            doanhnghiep.BanDo = filename;

        }
        else
        {
            doanhnghiep.BanDo = "no_images.jpg";
        }
        DoanhNghiep_BUS.Insert(doanhnghiep);
    }
}
